﻿using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Myotragus.Data.Util
{
	public static class StringExtensions
	{
		public static string Join(this IEnumerable<string> source, string separator)
		{
			if (!source.Any())
				return string.Empty;

			var result = new StringBuilder();
			result.Append(source.First());

			foreach (var part in source.Skip(1))
			{
				result.Append(separator);
				result.Append(part);	
			}

			return result.ToString();
		}

		public static string Join(this IEnumerable<string> source)
		{
			return source.Join(string.Empty);
		}
	}
}